# Create your models here.

from django.db import models
from django.shortcuts import render


class Blog(models.Model):
    title = models.CharField(max_length=20)
    classify = models.TextField(max_length=10)
    content = models.TextField()
    cover = models.CharField(max_length=255)
    date_time = models.DateTimeField()


class BlogComment(models.Model):
    content = models.CharField(max_length=200)
    comment_date_time = models.DateTimeField(auto_now_add=True)
    blog_id = models.ForeignKey(Blog, on_delete=models.CASCADE)


class Category(models.Model):
    name = models.CharField(max_length=10)

    # 模型类元数据配置
    class Meta():
        verbose_name = '分类名'
        verbose_name_plural = verbose_name
